package cn.howxu.yichen_ovo.registry;

import cn.howxu.yichen_ovo.YiChenOVO;
import cn.howxu.yichen_ovo.client.render.entity.CompletionistBannerRenderer;
import cn.howxu.yichen_ovo.init.ModEntities;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.minecraftforge.client.event.RegisterClientReloadListenersEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import cn.howxu.yichen_ovo.client.render.entity.PaintingRenderer;
import cn.howxu.yichen_ovo.client.render.entity.PaintingTextureManager;

/**
 * @description: TODO
 * @author: HowXu
 * @date: 2025/9/25 12:37
 */
@Mod.EventBusSubscriber(modid = YiChenOVO.MODID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
public class YiChenOVOClient {
    @SubscribeEvent
    public static void register(EntityRenderersEvent.RegisterRenderers event) {
        event.registerBlockEntityRenderer(ModEntities.FLAG.get(), CompletionistBannerRenderer::new);
        event.registerEntityRenderer(ModEntities.PAINTING.get(), PaintingRenderer::new);

    }

    @SubscribeEvent
    public static void beforeClientSetup(EntityRenderersEvent.RegisterLayerDefinitions event) {
        // EntityModelLayerRegistry.register(CompletionistBannerRenderer.LAYER_LOCATION, CompletionistBannerRenderer::createBodyLayer);
        event.registerLayerDefinition(CompletionistBannerRenderer.LAYER_LOCATION,CompletionistBannerRenderer::createBodyLayer);
    }

    @SubscribeEvent
    public static void onRegisterReloadListeners(final RegisterClientReloadListenersEvent event) {
        PaintingTextureManager.initialize(event);
    }
}
